
package me.zhengjie.repository;

import me.zhengjie.domain.AppEvent;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
* @website https://el-admin.vip
* @author IQW
* @date 2022-07-03
**/
public interface AppEventRepository extends JpaRepository<AppEvent, Integer>, JpaSpecificationExecutor<AppEvent> {

    @Query(value = "SELECT * FROM app_event WHERE" +
            " fid = ?1 order by event_id desc limit 1", nativeQuery = true)
    AppEvent findByFid(Integer fid);

    @Modifying
//    @Query(value = "delete from app_work_gps where work_id= ?1",nativeQuery = true)
    void deleteByWorkId(Integer workId);

}